package com.ruoyi.web.controller.app;

import java.util.List;
import java.util.Arrays;
import java.util.concurrent.TimeUnit;

import com.ruoyi.app.domain.bo.AppImGroupJoinLogBo;
import com.ruoyi.app.domain.vo.AppImGroupJoinLogVo;
import com.ruoyi.app.service.IAppImGroupJoinLogService;
import com.ruoyi.web.req.AddGroupReq;
import lombok.RequiredArgsConstructor;
import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.*;
import cn.dev33.satoken.annotation.SaCheckPermission;
import org.springframework.web.bind.annotation.*;
import org.springframework.validation.annotation.Validated;
import com.ruoyi.common.annotation.RepeatSubmit;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.PageQuery;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.validate.AddGroup;
import com.ruoyi.common.core.validate.EditGroup;
import com.ruoyi.common.core.validate.QueryGroup;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 群组进退记录
 *
 * @author ruoyi
 * @date 2025-11-13
 */
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/app/imGroupJoinLog")
public class AppImGroupJoinLogController extends BaseController {

    private final IAppImGroupJoinLogService iAppImGroupJoinLogService;

    /**
     * 查询群备注
     */
    @GetMapping("/getGroupRemark")
    public R<?> getGroupRemark(@RequestParam("groupId") String groupId) {
        return iAppImGroupJoinLogService.getGroupRemark(groupId);
    }


    /**
     * 设置群备注
     */
    @GetMapping("/setGroupRemark")
    public R<?> setGroupRemark(@RequestParam("groupId") String groupId,
                               @RequestParam("remark") String remark) {
        return iAppImGroupJoinLogService.setGroupRemark(groupId,remark);
    }

    /**
     * 查询群组进退记录列表
     */
    @GetMapping("/list")
    public TableDataInfo<AppImGroupJoinLogVo> list(AppImGroupJoinLogBo bo, PageQuery pageQuery) {
        return iAppImGroupJoinLogService.queryPageList(bo, pageQuery);
    }


    /**
     * 新增群组进退记录
     */
    @Log(title = "群组进退记录", businessType = BusinessType.INSERT)
    @RepeatSubmit()
    @PostMapping()
    public R<Void> addList(@Validated(AddGroup.class) @RequestBody AddGroupReq addGroupReq) {
        return toAjax(iAppImGroupJoinLogService.addList(addGroupReq.getAppImGroupJoinLogBos()) ? 1 : 0);
    }

}
